<template>
    <h2>会员基本信息</h2>
    <table border="1">
        <tr>
            <td>会员真实姓名</td>
            <td>{{member.MI_Name }}</td>
        </tr>
        <tr>
            <td>会员手机号</td>
            <td>{{ member.MI_Phone }}</td>
        </tr>
        <tr>
            <td>会员身份证号</td>
            <td>{{ member.MI_IdCard }}</td>
        </tr>
        <tr>
            <td>会员状态</td>
            <td>{{member.MI_State }}</td>
        </tr>
        <tr>
            <td>会员家庭住址</td>
            <td>{{  member.MI_Name}}</td>
        </tr>
        <tr>
            <td>会员积分</td>
            <td>{{member.MI_Money  }}</td>
        </tr>
      <tr>
        <td colspan="2" style="text-align:center"> 
            <input type="button" value="我的优惠券" @click="UserMemberInfo(member.ML_Id)"/>
        </td>
      </tr>
    </table>
</template>

<script setup lang="ts">
    import {ref,onMounted} from 'vue'
    import axios from 'axios'
    import {useRouter} from 'vue-router'
    const router=useRouter();
    const UserMemberInfo=(ML_Id:string)=>{
        router.push({
            path:"/MemberDiscountList",
            query:{
                ML_Id:ML_Id
            }
        })
    }
    const member=ref({
        "ML_Id": "fde673ef-35ad-4421-9780-4a224d66b4a9",
    "ML_Name": "张三",
    "ML_Pwd": "202CB962AC59075B964B07152D234B70",
    "MI_Name": "张三",
    "MI_Phone": "151525252",
    "MI_Money": 23,
    "MI_Date": "2002-10-25T00:00:00",
    "MI_IdCard": "132011200210253652",
    "MI_Address": "十分大师傅",
    "MI_Img": "https://localhost:44320/Images/car.png",
    "MI_Sex": false,
    "MI_State": 1,
    "MT_Name": "管理员"
    })
    const params=new URLSearchParams(location.search);
    const ML_Id=params.get('ML_Id');
    onMounted(()=>{
        axios.get('https://localhost:44320/api/Discount/MemberInfosShow',
        {
            params:{
                ML_Id:ML_Id
            }
        })
        .then(res=>{
            console.log(res.data);
            member.value=res.data[0];
        })
    })
</script>